import { defineClientConfig } from "@vuepress/client";
import vuePkg from "vue/package.json";
import vp from "vuepress/package.json";

import ArcoVue from '@arco-design/web-vue';
import '@arco-design/web-vue/dist/arco.css';

import Layout from './layouts/Layout.vue'

//消息总线
import Bus from './bus/bus.js';

export default defineClientConfig({
    enhance({ app, router, siteData }) {
        app.use(ArcoVue)

        console.log(app)
        router.afterEach((to) => {
            console.log('跳页了 ' + to)
            //通知代码复制组件 跳页面了， 重新渲染 复制按钮
            Bus.$emit('codeCopyToPage',null);
        })
    },
    setup(){
        console.log("setup 开始")
    },
    //挂载组件
    rootComponents:[
        Layout,
    ],
});



//添加一些有逼格的启动日志
function showBadge(name, version, nameStyle, versionStyle) {
    console.log(
        "%c ".concat(name, " %c ").concat(version, " "),
        "padding: 1px; border-radius: 3px 0 0 3px; color: #fff; background: ".concat(
            nameStyle,
            ";"
        ),
        "padding: 1px; border-radius: 0 3px 3px 0; color: #fff; background: ".concat(
            versionStyle,
            ";"
        )
    );
}

showBadge("追风铃的小屋", '(^_−)☆', "#606060", "RGB(20,117,178)");
showBadge("vue", vuePkg.version, "#606060", "RGB(20,117,178)");
showBadge("vuepress", vp.version, "#606060", "RGB(20,117,178)");
